﻿using System;
using System.IO;

namespace HeyoUi.Util
{
    public class GameLocator
    {
        public static string GetGameInfoJsonPath(string version)
        {
            return Path.Combine(Environment.CurrentDirectory,
                $@".minecraft\versions\{version}\{version}-info.json");
        }
        public static string GetJarPath(string version)
        {
            return Path.Combine(Environment.CurrentDirectory,
                $@".minecraft\versions\{version}\{version}.jar");
        }

        public static string GetJsonPath(string version)
        {
            return Path.Combine(Environment.CurrentDirectory,
                $@".minecraft\versions\{version}\{version}.json");
        }

        public static string GetLibPath(string fullName)
        {
            //example :"org.scala-lang:scala-library:2.11.1"
            string[] splits = fullName.Split(':');  //split it
            string ns = splits[0];                  //org.scala-lang
            string libName = splits[1];             //scala-library
            string version = splits[2];             //2.11.1
            return $@"{LauncherBasic.KmcccCore.GameRootPath}\libraries\{ns.Replace(".", "\\")}\{libName}\{version}\{libName}-{version}.jar";
        }

        public static string GetModDirectory(string versionName)
        {
            return Path.Combine(Environment.CurrentDirectory,
                $@".minecraft\mods\");
        }
    }
}
